#pragma once // Pragma once means that this file should not be included more than once. Might only work in visual studio.

/*
	A point is specified with floats.
	The actual coordinates are naturally ints,
	but in order to simulate something in between
	the coordinates we need to use floats.
	When an object is displayed, the coordinates
	are converted to ints.
	We use templates so we can reuse the code for both ints and floats. Here, T is the type.
*/

/* A general 2 dimensional vector */
class vector_2D_t 
{
public:
	vector_2D_t() : x(0.0), y(0.0) {}
	vector_2D_t(const vector_2D_t &vector_2D) : x(vector_2D.x), y(vector_2D.y) {}
	vector_2D_t(float x, float y) : x(x), y(y) {}
	float x;
	float y;
};

/* The state of a body */
class state_t
{
public:
	state_t() : s(), v() {}
	state_t(const state_t &state) : s(state.s), v(state.v) {}
	state_t(const vector_2D_t &s, const vector_2D_t &v) : s(s), v(v) {}

	vector_2D_t s; // Position
	vector_2D_t v; // Veclocity
};

class shape_t
{
public:
	state_t state;

};

/* A coordinate is an integer point (used to write to screen) */
class coordinate_t
{
public:
	coordinate_t(){ x = 0; y = 0; }
	coordinate_t(const coordinate_t &coordinate){ x = coordinate.x; y = coordinate.y; }
	coordinate_t(int x, int y) : x(x), y(y) {}
	int x;
	int y;
};

class circle_t
{
public:
	circle_t(){ radius = 0; }
	circle_t(float radius) : radius(radius) {}
	float radius;
};

class rectangle_t
{
public:
	rectangle_t(){ }
	rectangle_t(float width, float height) 
		: width(width), height(height) {}

	vector_2D_t top_left;
	float width;
	float height;
};

class rectangle_screen_t
{
public:
	rectangle_screen_t(){ }
	rectangle_screen_t(const coordinate_t &top_left, int width, int height) 
		: top_left(top_left), width(width), height(height) {}

	coordinate_t top_left;
	int width;
	int height;
};

class color_t
{
public:
	color_t() : r(255), b(255), g(255) {}
	color_t( const color_t &color ) : r(color.r), g(color.g), b(color.b) {}
	color_t( int r, int g, int b ) : r(r), g(g), b(b) {}
	int r;
	int g;
	int b;
};

/*
template<class T, class U>
bool circle_rectangle_overlapping(const circle_t<T> &circle, const rectangle_t<U> &rectangle)
{
	// Used for checking wether a circle and a rectangle are colliding

	if(    ( circle.position.x + circle.radius >= rectangle.top_left.x )
		&& ( circle.position.x - circle.radius <= rectangle.top_left.x + rectangle.width )
		&& ( circle.position.y + circle.radius >= rectangle.top_left.y )
		&& ( circle.position.y - circle.radius <= rectangle.top_left.y + rectangle.width )
		) return true;

	return false;
}
*/